using System;
using System.Xml;
using InfoJetSoft.Service.Entity;
using InfoJetSoft.Service.Util;

namespace InfoJetSoft.Service
{
	/// <summary>
	/// Summary description for InfoJetFileAttachment.
	/// </summary>
	public class InfoJetFileAttachment
	{
		
		private Form form = null;
		private XmlNode fileAttachmentNode = null;
		private XFileAttachmentDecoder decoder = null;

		public InfoJetFileAttachment( Form innerForm, XmlNode xmlFileNode )
		{
			this.form = innerForm;
			this.fileAttachmentNode = xmlFileNode;	
		}

		public void Decode()
		{
			this.decoder = new XFileAttachmentDecoder( this.form, DOMUtil.getNodeValue( this.fileAttachmentNode ), false );
		}

		public XmlNode XmlNode
		{
			get{ return this.fileAttachmentNode; }
		}

		public string FileName
		{
			get{ return this.decoder.FileName; }
		}

		public int FileSize
		{
			get{ return this.decoder.FileSize; }
		}

		public byte[] DecodedAttachment
		{
			get{ return this.decoder.DecodedAttachment; }
		}
	}
}
